package ynu.edu.achitecturework.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ynu.edu.achitecturework.common.result.Result;
import ynu.edu.achitecturework.dao.GreenhouseDAO;
import ynu.edu.achitecturework.entity.Greenhouse;

import java.util.List;

@RestController
@RequestMapping("/api/greenhouse")
@RequiredArgsConstructor
@Slf4j
public class GreenhouseController {

    private final GreenhouseDAO greenhouseDAO;

    @GetMapping("/get")
    public Result<List<Greenhouse>> getAllGreenhouses() {
        return Result.success(greenhouseDAO.findAll());
    }
}